<template>
  <el-tabs v-model="active">
    <el-tab-pane label="文件" name="file">
      <FileMain ref="fileMain"/>
    </el-tab-pane>
    <el-tab-pane label="查询" name="tag">
      <Search @openNewTap="handleOpen"/>
    </el-tab-pane>
    <el-tab-pane label="标签管理">
      <NewTagManage/>
    </el-tab-pane>
  </el-tabs>
</template>

<script lang="ts" setup>
import FileMain from "./modules/file/FileMain.vue";
import Search from "./modules/tag/Search.vue";
import {writeToDataFile} from "./api/file";
import NewTagManage from "./modules/tag/NewTagManage.vue";

const active = ref("file");
const fileMain = ref<any>();
const handleOpen = (path: string) => {
  active.value = "file";
  fileMain.value.addNewTab(path)
}

window.onbeforeunload = (e) => {
  // 不关闭窗口
  // e.returnValue = false;
  writeToDataFile()
}


</script>

<style>
.el-card {
  text-align: center;
}

* {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
</style>
